#pragma once
#include <iostream>
#include <string>
#include "jsoncpp/json/json.h"

enum ServerType
{
	CreateRoom = 0,
	StartGame,
	DestoryRoom,

	JoinRoom,
	QuitRoom,
	Ready,
	CancelReady,


	PlayGame,

	PlayerMove,
	SwordMove,


	BlockCollision,
	PlayerCollision,
	SwordCollision,
	EdgeCollision,

};

std::string ServerTypeToString(ServerType server_type)
{
	switch (server_type)
	{
	case CreateRoom:
		return "CreateRoom";
		break;
	case StartGame:
		return "StartGame";
		break;
	case DestoryRoom:
		return "DestoryRoom";
		break;
	case JoinRoom:
		return "JoinRoom";
		break;
	case QuitRoom:
		return "QuitRoom";
		break;
	case PlayGame:
		return "PlayGame";
		break;
	default:
		return "";
		break;
	}
}

class Request
{
public:
	Request() {}

	virtual bool Serialize(std::string *msg) = 0;
	virtual bool Deserialize(const Json::Value &root) = 0;

	virtual ~Request() {}

private:
};

class Response
{
public:
	Response() {}

	virtual bool Serialize(std::string *msg) = 0;
	// virtual bool ServerHandler(const Request* req, int fd) = 0;
	virtual bool Deserialize(const std::string &result) = 0;

	virtual ~Response() {}

private:
};
